{
 "cells": [
  {
   "cell_type": "code",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-25T07:58:09.512233Z",
     "start_time": "2024-12-25T07:58:00.862154Z"
    }
   },
   "source": [
    "from sklearn.feature_extraction.text import TfidfVectorizer\n",
    "from sklearn.linear_model import RidgeClassifier, LogisticRegression\n",
    "from lightgbm import LGBMClassifier\n",
    "import lightgbm as lgb\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "from sklearn.metrics import f1_score\n",
    "\n",
    "%pylab inline\n",
    "\n",
    "train_df = pd.read_csv('../input/train_set.csv', sep='\\t', nrows=None)\n",
    "test_df = pd.read_csv('../input/test_a.csv', sep='\\t', nrows=None)"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Populating the interactive namespace from numpy and matplotlib\n"
     ]
    }
   ],
   "execution_count": 1
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 数据划分"
   ]
  },
  {
   "cell_type": "code",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-25T07:58:12.167183Z",
     "start_time": "2024-12-25T07:58:12.162186Z"
    }
   },
   "source": [
    "# hold-out\n",
    "from sklearn.model_selection import train_test_split\n",
    "\n",
    "# K折交叉验证\n",
    "from sklearn.model_selection import KFold\n",
    "from sklearn.model_selection import RepeatedKFold\n",
    "\n",
    "# K折分布保持交叉验证\n",
    "from sklearn.model_selection import StratifiedKFold\n",
    "from sklearn.model_selection import RepeatedStratifiedKFold\n",
    "\n",
    "# 时间序列划分方法\n",
    "from sklearn.model_selection import TimeSeriesSplit\n",
    "\n",
    "# booststrap 采样\n",
    "from sklearn.utils import resample"
   ],
   "outputs": [],
   "execution_count": 2
  },
  {
   "cell_type": "code",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-25T07:58:14.306573Z",
     "start_time": "2024-12-25T07:58:14.293010Z"
    }
   },
   "source": [
    "X = np.zeros((20, 5))\n",
    "Y = np.array([1, 2, 3, 4] * 5)\n",
    "print(X, Y)\n",
    "\n",
    "# X = np.zeros((20, 5))\n",
    "# Y = np.array([1]*5 + [2]*5 + [3]*5 + [4]*5)\n",
    "# print(X, Y)"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[0. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 0.]] [1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4]\n"
     ]
    }
   ],
   "execution_count": 3
  },
  {
   "cell_type": "code",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-25T07:58:16.233241Z",
     "start_time": "2024-12-25T07:58:16.215142Z"
    }
   },
   "source": [
    "# 直接按照比例拆分\n",
    "# train_X, val_X, train_y, val_y = train_test_split(X, Y, test_size = 0.2)\n",
    "# print(train_y, val_y)\n",
    "\n",
    "# 按照比例 & 标签分布划分\n",
    "train_X, val_X, train_y, val_y = train_test_split(X, Y, test_size = 0.2, stratify=Y)\n",
    "print(train_y, val_y)"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[2 1 2 1 3 1 4 4 2 4 3 4 1 3 2 3] [1 2 4 3]\n"
     ]
    }
   ],
   "execution_count": 4
  },
  {
   "cell_type": "code",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-25T07:58:17.827607Z",
     "start_time": "2024-12-25T07:58:17.809567Z"
    }
   },
   "source": [
    "kf = KFold(n_splits=5)\n",
    "for train_idx, test_idx, in kf.split(X, Y):\n",
    "    print(train_idx, test_idx)\n",
    "    print('Label', Y[test_idx])\n",
    "    print('')"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19] [0 1 2 3]\n",
      "Label [1 2 3 4]\n",
      "\n",
      "[ 0  1  2  3  8  9 10 11 12 13 14 15 16 17 18 19] [4 5 6 7]\n",
      "Label [1 2 3 4]\n",
      "\n",
      "[ 0  1  2  3  4  5  6  7 12 13 14 15 16 17 18 19] [ 8  9 10 11]\n",
      "Label [1 2 3 4]\n",
      "\n",
      "[ 0  1  2  3  4  5  6  7  8  9 10 11 16 17 18 19] [12 13 14 15]\n",
      "Label [1 2 3 4]\n",
      "\n",
      "[ 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15] [16 17 18 19]\n",
      "Label [1 2 3 4]\n",
      "\n"
     ]
    }
   ],
   "execution_count": 5
  },
  {
   "cell_type": "code",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-25T07:58:19.613901Z",
     "start_time": "2024-12-25T07:58:19.602384Z"
    }
   },
   "source": [
    "kf = StratifiedKFold(n_splits=5)\n",
    "for train_idx, test_idx, in kf.split(X, Y):\n",
    "    print(train_idx, test_idx)\n",
    "    print('Label', Y[test_idx])\n",
    "    print('')"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19] [0 1 2 3]\n",
      "Label [1 2 3 4]\n",
      "\n",
      "[ 0  1  2  3  8  9 10 11 12 13 14 15 16 17 18 19] [4 5 6 7]\n",
      "Label [1 2 3 4]\n",
      "\n",
      "[ 0  1  2  3  4  5  6  7 12 13 14 15 16 17 18 19] [ 8  9 10 11]\n",
      "Label [1 2 3 4]\n",
      "\n",
      "[ 0  1  2  3  4  5  6  7  8  9 10 11 16 17 18 19] [12 13 14 15]\n",
      "Label [1 2 3 4]\n",
      "\n",
      "[ 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15] [16 17 18 19]\n",
      "Label [1 2 3 4]\n",
      "\n"
     ]
    }
   ],
   "execution_count": 6
  },
  {
   "cell_type": "code",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-25T07:58:21.159587Z",
     "start_time": "2024-12-25T07:58:21.147563Z"
    }
   },
   "source": [
    "kf = TimeSeriesSplit(n_splits=5)\n",
    "for train_idx, test_idx, in kf.split(X, Y):\n",
    "    print(train_idx, test_idx)\n",
    "    print('Label', Y[test_idx])\n",
    "    print('')"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0 1 2 3 4] [5 6 7]\n",
      "Label [2 3 4]\n",
      "\n",
      "[0 1 2 3 4 5 6 7] [ 8  9 10]\n",
      "Label [1 2 3]\n",
      "\n",
      "[ 0  1  2  3  4  5  6  7  8  9 10] [11 12 13]\n",
      "Label [4 1 2]\n",
      "\n",
      "[ 0  1  2  3  4  5  6  7  8  9 10 11 12 13] [14 15 16]\n",
      "Label [3 4 1]\n",
      "\n",
      "[ 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16] [17 18 19]\n",
      "Label [2 3 4]\n",
      "\n"
     ]
    }
   ],
   "execution_count": 7
  },
  {
   "cell_type": "code",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-25T07:58:23.013061Z",
     "start_time": "2024-12-25T07:58:23.000429Z"
    }
   },
   "source": [
    "train_X, train_Y = resample(X, Y, n_samples=16)\n",
    "val_X, val_Y = resample(X, Y, n_samples=4)\n",
    "print(train_Y, val_Y)"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[3 3 4 3 1 3 2 3 3 4 4 2 4 4 4 2] [2 4 2 4]\n"
     ]
    }
   ],
   "execution_count": 8
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# fasttext"
   ]
  },
  {
   "cell_type": "code",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-25T07:58:39.139097Z",
     "start_time": "2024-12-25T07:58:24.669573Z"
    }
   },
   "source": [
    "train_df = pd.read_csv('../input/train_set.csv', sep='\\t', nrows=None)\n",
    "train_df['label_ft'] = '__label__' + train_df['label'].astype(str)\n",
    "train_df[['text','label_ft']].iloc[:-5000].to_csv('train.csv', index=None, header=None, sep='\\t')\n",
    "train_df[['text','label_ft']].iloc[-5000:].to_csv('valid.csv', index=None, header=None, sep='\\t')"
   ],
   "outputs": [],
   "execution_count": 9
  },
  {
   "cell_type": "code",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-25T07:59:13.463921Z",
     "start_time": "2024-12-25T07:59:03.257274Z"
    }
   },
   "source": [
    "import fasttext\n",
    "model = fasttext.train_supervised(input='train.csv',\n",
    "                                  autotuneValidationFile='valid.csv', \n",
    "                                  autotuneDuration=10)"
   ],
   "outputs": [
    {
     "ename": "RuntimeError",
     "evalue": "Didn't have enough time to train once: please increase `autotune-duration`.",
     "output_type": "error",
     "traceback": [
      "\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
      "\u001B[1;31mRuntimeError\u001B[0m                              Traceback (most recent call last)",
      "\u001B[1;32m<ipython-input-12-9e33f9b02727>\u001B[0m in \u001B[0;36m<module>\u001B[1;34m\u001B[0m\n\u001B[0;32m      2\u001B[0m model = fasttext.train_supervised(input='train.csv',\n\u001B[0;32m      3\u001B[0m                                   \u001B[0mautotuneValidationFile\u001B[0m\u001B[1;33m=\u001B[0m\u001B[1;34m'valid.csv'\u001B[0m\u001B[1;33m,\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m----> 4\u001B[1;33m                                   autotuneDuration=10)\n\u001B[0m",
      "\u001B[1;32mD:\\Anaconda3\\envs\\Tianchi-NLP-Beginner-master\\lib\\site-packages\\fasttext\\FastText.py\u001B[0m in \u001B[0;36mtrain_supervised\u001B[1;34m(*kargs, **kwargs)\u001B[0m\n\u001B[0;32m    531\u001B[0m     \u001B[0ma\u001B[0m \u001B[1;33m=\u001B[0m \u001B[0m_build_args\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0margs\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mmanually_set_args\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m    532\u001B[0m     \u001B[0mft\u001B[0m \u001B[1;33m=\u001B[0m \u001B[0m_FastText\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0margs\u001B[0m\u001B[1;33m=\u001B[0m\u001B[0ma\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m--> 533\u001B[1;33m     \u001B[0mfasttext\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mtrain\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mft\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mf\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0ma\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m\u001B[0;32m    534\u001B[0m     \u001B[0mft\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mset_args\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mft\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mf\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mgetArgs\u001B[0m\u001B[1;33m(\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m    535\u001B[0m     \u001B[1;32mreturn\u001B[0m \u001B[0mft\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n",
      "\u001B[1;31mRuntimeError\u001B[0m: Didn't have enough time to train once: please increase `autotune-duration`."
     ]
    }
   ],
   "execution_count": 12
  },
  {
   "cell_type": "code",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-25T07:59:01.631725Z",
     "start_time": "2024-12-25T07:59:01.615549Z"
    }
   },
   "source": [
    "model.test(\"valid.csv\")"
   ],
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'model' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
      "\u001B[1;31mNameError\u001B[0m                                 Traceback (most recent call last)",
      "\u001B[1;32m<ipython-input-11-bc07fa8d0eba>\u001B[0m in \u001B[0;36m<module>\u001B[1;34m\u001B[0m\n\u001B[1;32m----> 1\u001B[1;33m \u001B[0mmodel\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mtest\u001B[0m\u001B[1;33m(\u001B[0m\u001B[1;34m\"valid.csv\"\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m",
      "\u001B[1;31mNameError\u001B[0m: name 'model' is not defined"
     ]
    }
   ],
   "execution_count": 11
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 对抗验证"
   ]
  },
  {
   "cell_type": "code",
   "metadata": {
    "scrolled": true,
    "ExecuteTime": {
     "end_time": "2024-12-25T07:59:28.742088Z",
     "start_time": "2024-12-25T07:59:17.342348Z"
    }
   },
   "source": [
    "from sklearn.feature_extraction.text import TfidfVectorizer\n",
    "train_df = pd.read_csv('../input/train_set.csv', sep='\\t', nrows=5000)\n",
    "test_df = pd.read_csv('../input/test_a.csv', sep='\\t', nrows=5000)\n",
    "\n",
    "tfidf = TfidfVectorizer(ngram_range=(1, 2), max_features=500).fit(train_df['text'].iloc[:].values)\n",
    "train_tfidf = tfidf.transform(train_df['text'].iloc[:].values)\n",
    "test_tfidf = tfidf.transform(test_df['text'].iloc[:].values)"
   ],
   "outputs": [],
   "execution_count": 13
  },
  {
   "cell_type": "code",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-12-25T07:59:33.014502Z",
     "start_time": "2024-12-25T07:59:32.982794Z"
    }
   },
   "source": [
    "train_test = np.vstack([train_tfidf.toarray(), test_tfidf.toarray()])"
   ],
   "outputs": [],
   "execution_count": 14
  },
  {
   "cell_type": "code",
   "metadata": {
    "scrolled": true,
    "ExecuteTime": {
     "end_time": "2024-12-25T07:59:35.390806Z",
     "start_time": "2024-12-25T07:59:34.109891Z"
    }
   },
   "source": [
    "lgb_data = lgb.Dataset(train_test, label=np.array([1]*5000+[0]*5000))\n",
    "\n",
    "params = {}\n",
    "params['max_bin'] = 10\n",
    "params['learning_rate'] = 0.01\n",
    "params['boosting_type'] = 'gbdt'\n",
    "params['metric'] = 'auc'\n",
    "\n",
    "result = lgb.cv(params, lgb_data, num_boost_round=100, nfold=3, verbose_eval=20)"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[LightGBM] [Warning] Auto-choosing row-wise multi-threading, the overhead of testing was 0.022360 seconds.\n",
      "You can set `force_row_wise=true` to remove the overhead.\n",
      "And if memory is not enough, you can set `force_col_wise=true`.\n",
      "[LightGBM] [Info] Total Bins 5000\n",
      "[LightGBM] [Info] Number of data points in the train set: 6666, number of used features: 500\n",
      "[LightGBM] [Warning] Auto-choosing row-wise multi-threading, the overhead of testing was 0.018110 seconds.\n",
      "You can set `force_row_wise=true` to remove the overhead.\n",
      "And if memory is not enough, you can set `force_col_wise=true`.\n",
      "[LightGBM] [Info] Total Bins 5000\n",
      "[LightGBM] [Info] Number of data points in the train set: 6667, number of used features: 500\n",
      "[LightGBM] [Warning] Auto-choosing row-wise multi-threading, the overhead of testing was 0.016592 seconds.\n",
      "You can set `force_row_wise=true` to remove the overhead.\n",
      "And if memory is not enough, you can set `force_col_wise=true`.\n",
      "[LightGBM] [Info] Total Bins 5000\n",
      "[LightGBM] [Info] Number of data points in the train set: 6667, number of used features: 500\n",
      "[LightGBM] [Info] Start training from score 0.500000\n",
      "[LightGBM] [Info] Start training from score 0.499925\n",
      "[LightGBM] [Info] Start training from score 0.500075\n",
      "[20]\tcv_agg's auc: 0.491052 + 0.00882533\n",
      "[40]\tcv_agg's auc: 0.491945 + 0.0116601\n",
      "[60]\tcv_agg's auc: 0.493146 + 0.0105694\n",
      "[80]\tcv_agg's auc: 0.494341 + 0.00770488\n",
      "[100]\tcv_agg's auc: 0.495576 + 0.00556407\n"
     ]
    }
   ],
   "execution_count": 15
  },
  {
   "cell_type": "code",
   "metadata": {
    "scrolled": true,
    "ExecuteTime": {
     "end_time": "2024-12-25T07:59:37.176072Z",
     "start_time": "2024-12-25T07:59:37.160523Z"
    }
   },
   "source": [
    "pd.DataFrame(result)"
   ],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "    auc-mean  auc-stdv\n",
       "0   0.491807  0.004728\n",
       "1   0.489903  0.001308\n",
       "2   0.493536  0.001168\n",
       "3   0.493294  0.001798\n",
       "4   0.493753  0.002040\n",
       "..       ...       ...\n",
       "95  0.495292  0.005919\n",
       "96  0.495490  0.005592\n",
       "97  0.495188  0.005741\n",
       "98  0.495539  0.005762\n",
       "99  0.495576  0.005564\n",
       "\n",
       "[100 rows x 2 columns]"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>auc-mean</th>\n",
       "      <th>auc-stdv</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.491807</td>\n",
       "      <td>0.004728</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.489903</td>\n",
       "      <td>0.001308</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.493536</td>\n",
       "      <td>0.001168</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.493294</td>\n",
       "      <td>0.001798</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.493753</td>\n",
       "      <td>0.002040</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>0.495292</td>\n",
       "      <td>0.005919</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>0.495490</td>\n",
       "      <td>0.005592</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>0.495188</td>\n",
       "      <td>0.005741</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>0.495539</td>\n",
       "      <td>0.005762</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>0.495576</td>\n",
       "      <td>0.005564</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 2 columns</p>\n",
       "</div>"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 16
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.5"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
